let express = require('express');
let router = express.Router();


/* GET home page. */


/**
 * 添加字典详情
 */
router.all('/addDictionaryDetail', function (req, res, next) {
    global['bean'].DictionaryDetailService.addDictionaryDetailEntity(req.args).then(data => {
        res.json(res.wrap(20000, '添加成功!', data));
    }).catch(e => {
        next(e);
    });
});


/**
 * 删除字典详情
 */
router.all('/removeDictionaryDetail', function (req, res, next) {
    global['bean'].DictionaryDetailService.removeDictionaryDetailEntity(req.args).then(data => {
        res.json(res.wrap(20000, '删除成功!', data))
    }).catch(e => {
        next(e);
    });
});


/**
 * 更新字典详情
 */
router.all('/updateDictionaryDetail', function (req, res, next) {
    global['bean'].DictionaryDetailService.updateDictionaryDetailEntity(req.args).then(data => {
        res.json(res.wrap(20000, '更新成功', data))
    }).catch(e => {
        next(e);
    });
});

/**
 * 查询字典详情（分页）
 */
router.all('/listDictionaryDetails', function (req, res, next) {
    global['bean'].DictionaryDetailService.listDictionaryDetailEntities(req.args.start || 0, req.args.size || 10,req.args.keyWord,req.args.t_did||"").then(data => {
        res.json(res.wrap(20000, '查询', data))
    }).catch(e => {
        next(e);
    });
});

/**
 * 查询字典详情（未分页）
 */
router.all('/listDictionaryDetailsNoPage', function (req, res, next) {
    global['bean'].DictionaryDetailService.listDictionaryDetailEntitiesNoPage(req.args.t_did).then(data => {
        res.json(res.wrap(20000, '查询', data))
    }).catch(e => {
        next(e);
    });
});


module.exports = router;
